#LD = ld -m elf_i386 
CC = gcc

#CFLAGS = -fno-builtin -nostdinc -I../include -nostdlib -Wall
CFLAGS = -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I../include

OBJS = stdio.o stdlib.o string.o

all: $(OBJS)
	@echo
#	@ar rcs libc.a $(OBJS)
	@ar r libc.a $(OBJS)

.c.o:
	$(CC) $(CFLAGS) -c -o $@ $<


.S.o:
	$(CC) $(CFLAGS) -traditional -c -o $@ $<

clean:
	rm -f *.o *.a

dep:
	find . -name '*.c'|xargs gcc -M -$(CFLAGS) > .depend

.PHONY: dep clean

ifeq (.depend,$(wildcard .depend))
include .depend
endif
